/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.nxlv2.nomad.accessdb.services;

import com.nxlv2.nomad.accessdb.dao.ICommandeDao;
import com.nxlv2.nomad.accessdb.dao.ISatisfactionDao;
import com.nxlv2.nomad.accessdb.dao.jdbc.JdbcCommandeDao;
import com.nxlv2.nomad.accessdb.dao.jdbc.JdbcSatisfactionDao;
import com.nxlv2.nomad.businessobjects.Commande;
import com.nxlv2.nomad.businessobjects.Satisfaction;
import java.util.List;

/**
 *
 * @author Administrateur
 */
public class SatisfactionServices {
    private static final ISatisfactionDao dao = new JdbcSatisfactionDao();
    private static final ICommandeDao daoC = new JdbcCommandeDao();
    
    /**
     * 
     * @param satisfaction
     * @param commande
     * @throws ServiceException 
     */
    public void create(Satisfaction satisfaction, Commande commande) throws ServiceException {
        dao.saveSatisfaction(satisfaction);
        daoC.lierSatisfactionACommande(satisfaction, commande);
    }
    
    /**
     * 
     * @param satisfaction
     * @throws ServiceException 
     */
    public void update(Satisfaction satisfaction) throws ServiceException {
        dao.updateSatisfaction(satisfaction);
    }
    
    /**
     * 
     * @param satisfaction
     * @throws ServiceException 
     */
    public void delete(Satisfaction satisfaction) throws ServiceException{
        dao.deleteSatisfaction(satisfaction.getIdAppli());
    }
    
    /**
     * 
     * @param id
     * @return Satisfaction
     * @throws ServiceException 
     */
    public Satisfaction get(int id) throws ServiceException {
        return dao.findById(id);
    }
}
